//
// Created by LiuYou on 2021/10/28.
//

#include <iostream>
#include <unistd.h>
#include <fcntl.h>


static const char* const FILE_NAME = "/tmp/out";

static int fd;


int main(int argc, char** argv) {

//    FILE_NAME;


    close( STDOUT_FILENO );

    fd = open( FILE_NAME, O_WRONLY | O_TRUNC | O_CREAT, 0666 );
//    fd = open( FILE_NAME, O_WRONLY | O_TRUNC | O_CREAT, 0600 );
    if (fd < 0) {
        perror( "open();" );
        return 1;
    }
//    atexit( []() -> void {
//        close( fd );
//    } );



/* ************************************************* */

    puts( "你好！" );


    return 0;
}
